#include <bits/stdc++.h>
using namespace std;
#define int long long
//using i64 = long long;
int print(int a, int b)
{
	cout << "? " << a << ' ' << b << endl;
	int x; 
	cin >> x;
	return x;
}

void solve()
{
	int n;
	cin >> n;
	int pos = -1;
	for (int i = 1; i + 1 <= n; i += 2)
	{
		int x = print(i, i + 1);
		if (x == 1)
		{
			pos = i;
			break;
		}
	}
	if (pos == -1 && n & 1)
	{
		int x = print(n - 1, n);
		if (x == 1) pos = n - 1;
	}
	if (pos == -1)
	{
		cout << "! 1" << endl;
		return;
	}
	if (pos != 1)
	{
		int x = print(pos, pos - 2);
		if (x == 1)
		{
			int y = print(pos, pos - 1);
			if (y == 1)
			{
				cout << "! 2" << endl;
				return;
			}
			else
			{
				cout << "! 1" << endl;
				return;
			}
		}
		else
		{
			int y = print(pos + 1, pos - 2);
			if (y == 0)
			{
				cout << "! 1" << endl;
				return;
			}
			else
			{
				int z = print(pos + 1, pos - 1);
				if (z == 1)
				{
					cout << "! 2" << endl;
					return;
				}
				else
				{
					cout << "! 1" << endl;
					return;
				}
			}
		}
	}
	else
	{
		int x = print(1, 3);
		if (x == 1)
		{
			int y = print(1, 4);
			if (y == 1)
			{
				cout << "! 2" << endl;
				return;
			}
			else
			{
				cout << "! 1" << endl;
				return;
			}
		}
		else
		{
			int y = print(2, 3);
			if (y == 0)
			{
				cout << "! 1" << endl;
				return;
			}
			else
			{
				int z = print(2, 4);
				if (z == 1)
				{
					cout << "! 2" << endl;
					return;
				}
				else
				{
					cout << "! 1" << endl;
					return;
				}
			}
		}
	}
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	int t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
}
